package com.cskaoyan;

import com.cskaoyan.mapper.StudentMapper;
import com.cskaoyan.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.lang.reflect.Proxy;

/**
 * 创建日期: 2022/11/22 17:52
 *
 * @author ciggar
 */
public class MybatisMain {


    public static void main(String[] args) {

        // 1. 获取SqlSession
        SqlSession sqlSession = MybatisUtils.getSqlSession();

        // 2. 获取接口的代理对象 (MapperProxy)
        StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);

        // 3. 执行接口中的方法
        int affectedRows = studentMapper.insertStduent();

        System.out.println("affectedRows:" + affectedRows);


    }
}
